package com.toolenaar.socialiceThis;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.toolenaar.socialiceThis.R;


public class MapOverlay extends Overlay {
	GeoPoint p;
	Context ctx;
 	public MapOverlay(GeoPoint _p,Context _ctx){
 		p = _p;
 		ctx = _ctx;
 	};
    @Override
    public boolean draw(Canvas canvas, MapView mapView, 
    boolean shadow, long when) 
    {
        super.draw(canvas, mapView, shadow);                   

        //---translate the GeoPoint to screen pixels---
        Point screenPts = new Point();
        mapView.getProjection().toPixels(p, screenPts);
        
        //---add the marker---
        Bitmap bmp = BitmapFactory.decodeResource(
           ctx.getResources(), R.drawable.pushpin);            
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y-30, null);         
        return true;
    }
}
